import mysqlDB from 'mysql'

let pool = mysqlDB.createPool({
  host: "localhost",
  user: "root",
  password: "root",
  database: "demo",
  port: "3306"
})

function dbConfig (sql,arr,callback) {
  pool.getConnection((err,connection) => {
    // 写入sql
    connection.query(sql,arr,(err,data) =>{
      // 返回数据
      callback(err,data)
      // 中断连接
      connection.release()
    })
  })
}

export default dbConfig